libotutil: remove ot-waitable-queue.
authorGiuseppe Scrivano <gscrivan@redhat.com>
Fri, 6 Mar 2015 10:48:24 +0000 (11:48 +0100)
committerGiuseppe Scrivano <gscrivan@redhat.com>
Fri, 6 Mar 2015 17:45:38 +0000 (18:45 +0100)
The module is not not used anymore.  It can be restored from git if
needed again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Makefile-otutil.am
src/libotutil/ot-waitable-queue.c [deleted file]
src/libotutil/ot-waitable-queue.h [deleted file]
src/libotutil/otutil.h

index 586f6d9ed68288c888542bae4f85f7e1625da225..16098e1d34f2d2555c9f7f4d3ae7507da634e777 100644 (file)
@@ -34,8 +34,6 @@ libotutil_la_SOURCES = \
        src/libotutil/ot-spawn-utils.h \
        src/libotutil/ot-variant-utils.c \
        src/libotutil/ot-variant-utils.h \
-       src/libotutil/ot-waitable-queue.c \
-       src/libotutil/ot-waitable-queue.h \
        src/libotutil/ot-gio-utils.c \
        src/libotutil/ot-gio-utils.h \
        src/libotutil/otutil.c \
diff --git a/src/libotutil/ot-waitable-queue.c b/src/libotutil/ot-waitable-queue.c
deleted file mode 100644 (file)
index 475c9c2..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2012 Colin Walters <walters@verbum.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Colin Walters <walters@verbum.org>
- */
-
-#include "config.h"
-
-#include "otutil.h"
-
-#include <glib-unix.h>
-#include <string.h>
-#include <sys/eventfd.h>
-#include <errno.h>
-#include <unistd.h>
-
-struct OtWaitableQueue {
-  volatile gint refcount;
-  GMutex mutex;
-  int fd;
-  gboolean read_empty;
-  GQueue queue;
-};
-
-OtWaitableQueue *
-ot_waitable_queue_new (void)
-{
-  OtWaitableQueue *queue = g_new0 (OtWaitableQueue, 1);
-  queue->refcount = 1;
-  g_mutex_init (&queue->mutex);
-  g_queue_init (&queue->queue);
-
-  queue->fd = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK);
-  g_assert (queue->fd >= 0);
-  
-  return queue;
-}
-
-void
-ot_waitable_queue_push (OtWaitableQueue *queue,
-                        gpointer         data)
-{
-  const guint64 val = 1;
-  int rval;
-
-  g_mutex_lock (&queue->mutex);
-  g_queue_push_head (&queue->queue, data);
-  do 
-    rval = write (queue->fd, &val, sizeof (val));
-  while (G_UNLIKELY (rval == -1 && errno == EINTR));
-  queue->read_empty = FALSE;
-  g_mutex_unlock (&queue->mutex);
-}
-
-gboolean
-ot_waitable_queue_pop (OtWaitableQueue *queue,
-                       gpointer        *out_data)
-{
-  gpointer ret = NULL;
-  gboolean empty = TRUE;
-  int rval;
-  guint64 val;
-
-  g_mutex_lock (&queue->mutex);
-  if (g_queue_peek_tail_link (&queue->queue) != NULL)
-    {
-      ret = g_queue_pop_tail (&queue->queue);
-      empty = FALSE;
-    }
-  else if (!queue->read_empty)
-    {
-      do
-        rval = read (queue->fd, &val, sizeof (val));
-      while (G_UNLIKELY (rval == -1 && errno == EINTR));
-      queue->read_empty = TRUE;
-    }
-  g_mutex_unlock (&queue->mutex);
-
-  *out_data = ret;
-  return !empty;
-}
-
-void
-ot_waitable_queue_ref (OtWaitableQueue *queue)
-{
-  g_atomic_int_inc (&queue->refcount);
-}
-
-void
-ot_waitable_queue_unref (OtWaitableQueue *queue)
-{
-  if (!g_atomic_int_dec_and_test (&queue->refcount))
-    return;
-  g_mutex_clear (&queue->mutex);
-  g_queue_clear (&queue->queue);
-  (void) close (queue->fd);
-  g_free (queue);
-}
-
-GSource *
-ot_waitable_queue_create_source (OtWaitableQueue   *queue)
-{
-  GIOChannel *iochan = g_io_channel_unix_new (queue->fd);
-  GSource *source = g_io_create_watch (iochan, G_IO_IN);
-  g_io_channel_unref (iochan);
-  return source;
-}
diff --git a/src/libotutil/ot-waitable-queue.h b/src/libotutil/ot-waitable-queue.h
deleted file mode 100644 (file)
index 29b8154..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2012 Colin Walters <walters@verbum.org>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Colin Walters <walters@verbum.org>
- */
-
-#pragma once
-
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-typedef struct OtWaitableQueue OtWaitableQueue;
-
-OtWaitableQueue *ot_waitable_queue_new (void);
-
-void ot_waitable_queue_push (OtWaitableQueue      *queue,
-                             gpointer              data);
-
-GSource *ot_waitable_queue_create_source (OtWaitableQueue   *queue);
-
-gboolean ot_waitable_queue_pop (OtWaitableQueue *queue,
-                                gpointer        *out_val);
-
-void ot_waitable_queue_ref (OtWaitableQueue *queue);
-void ot_waitable_queue_unref (OtWaitableQueue *queue);
-
-G_END_DECLS
index 6d764593fd4901624795806669dad245efbb7adf..61916025a03cd93820740411c513abe0127de3c2 100644 (file)
@@ -38,7 +38,6 @@
     }                                                      \
   } G_STMT_END;
 
-#include <ot-waitable-queue.h>
 #include <ot-keyfile-utils.h>
 #include <ot-gio-utils.h>
 #include <ot-fs-utils.h>